package br.com.lh.urabuilder.domain.xml
{
	import br.com.lh.urabuilder.domain.view.UraComponent;
	
	import mx.collections.ArrayCollection;
	
	[RemoteClass(alias="br.com.lh.ura.database.UraXml")] 
	public class UraXml{
		
		public var uraId:String;
		public var xmlString:String;
		public var alias:String = "";
		public var uraExtension:String;
		public var initialActionId:int;
		public var defaultExtensionId:String;
		
		public var xml:XML;
		public var uraViewList:ArrayCollection = new ArrayCollection();
		public var availableExtension:ArrayCollection = new ArrayCollection();
		public var soundFileList:ArrayCollection = new ArrayCollection();

		public function UraXml(){
			uraId ="-1";
			xml = 
			<ura xmlns="http://www.example.org/ura" 
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
			xsi:schemaLocation="http://www.example.org/ura ../../../main/resources/schema/ura.xsd ">
			</ura>
		}
		public function insert(id:int, x:int, y:int,alias:String,databaseId:int):void{
			var uraView:UraComponent = new UraComponent();
			uraView.elementId = id;
			uraView.XPosition = x;
			uraView.YPosition = y;
			uraView.alias =alias;
			uraView.id = databaseId;
			uraViewList.addItem(uraView);
		}
		
		public function clearViewArrays():void{
			uraViewList = new ArrayCollection();
		}
		
		public function setInitialActionId(actionId:int):void{
			if (actionId == -1){
				delete xml['@initialAction'];
			}else{
				xml['@initialAction'] = actionId;
			}
		}
		
	}
}